package com.org.redis.omos;

import com.org.redis.config.JedisUtil;
import redis.clients.jedis.Jedis;

import java.util.HashMap;
import java.util.Map;

public class HashDemo {

    public static void main(String[] args) {
        Jedis jedis = JedisUtil.getJedis();
        //存值
        Map<String,String> map = new HashMap();
        map.put("name","wang");
        map.put("age","23");
        jedis.hmset("user:1",map);
        //取值
        String name = jedis.hget("user:1", "name");
        System.out.println(name);
        Map<String, String> rs = jedis.hgetAll("user:1");
        System.out.println(rs);

    }
}
